﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NewsProgram.Models.NewsItem>>" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Nýjustu fréttir</h2>
    

      <!-- Your task is to write a news application which stores all its data in a database. 
        On the front page, the user should see a list of the latest 10 news entries. 
    
        The title of each news item should be a link that leads to an "Edit" page, where this item can be edited. 
        Having edited a news item, the user should be brought back to the main page.
     -->
      <%foreach (var item in Model) {%>
        <fieldset id="newsList">
            <h3>
                <%= Html.ActionLink(item.Title, "Edit", new { id = item.ID }, new { @class = "editNewsTitle" })%>
            </h3>
       
            <div id="newsDate"><%: item.DateAdded %></div>

            <%: item.NewsText %>
        </fieldset>
      <% } %>

</asp:Content>
